package com.dragon.graduation.finalDefense.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.graduation.finalDefense.controller.dto.FinalDefenseSearchDTO;
import com.dragon.graduation.finalDefense.controller.vo.FinalDefenseVO;
import com.dragon.graduation.finalDefense.entity.FinalDefenseEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 终期答辩表 Mapper 接口
 * </p>
 *
 * @author dragon
 * @since 2025-02-28 21:18:39
 */
@Mapper
public interface FinalDefenseMapper extends BaseMapper<FinalDefenseEntity> {

    @Select("select * from db_final_defense where student_id = #{studentId} and project_id = #{projectId} and status!=2 ORDER BY update_time DESC LIMIT 1")
    FinalDefenseEntity selectByProjectIdAndStudentId(@Param("projectId") Integer projectId, @Param("studentId") Integer studentId);

    Page<FinalDefenseVO> selectPages(Page<FinalDefenseEntity> entityPage, @Param("searchDTO") FinalDefenseSearchDTO searchDTO);
}
